﻿
Partial Class inventory_addinv
    Inherits System.Web.UI.Page


    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
        Session("logged") = Page.User.Identity.Name
        Dim a As String()
        a = Roles.GetRolesForUser(Page.User.Identity.Name)
        If a(0).Equals("Manager") Then
            SQLCompany.SelectCommand = "SELECT * FROM [inv_company]"
        Else
            SQLCompany.SelectCommand = "SELECT * FROM [inv_company] WHERE ([AssignedAgent] = @AssignedAgent)"
        End If



    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim Generator As System.Random = New System.Random()
        Session("logged") = Page.User.Identity.Name.ToLower

        Session("hardwareid") = Generator.Next(1000000, 9999999)
        Session("datenow") = Date.Now
        Session("softwareid") = Generator.Next(1000000, 9999999)

        SQLHardware.Insert()
        UnitKey.Insert()
        SQLSoftware.Insert()

    End Sub
End Class
